<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/6/5
 * Time: 下午11:07
 */

namespace App\Busi\Traits;


use App\Models\Level;

Trait LevelTrait
{
    public function getLevelNameByLevelId($level_id){
//        switch ($level_id){
//            case 1 :$name = "一级";break;
//            case 2 :$name = "二级";break;
//            case 3 :$name = "三级";break;
//            case 4 :$name = "A级";break;
//            case 5 :$name = "B级";break;
//            case 6 :$name = "C级";break;
//            case 7 :$name = "甲级";break;
//            case 8 :$name = "乙级";break;
//            case 9 :$name = "丙级";break;
//            case 10 :$name = "无分级";break;
//            default:$name = "无分级";break;
//        }
        $where = [
            ['id','=',$level_id]
        ];
        $name = "";
        $fields = ["name"];
        $level = Level::where($where)->select($fields)->first();
        if($level){
            return $level["name"];
        }
        return $name;

    }
}